package icu.feigroup.domain.activity.service.discount.impl;

import icu.feigroup.domain.activity.model.valobj.GroupActivityDiscountVO;
import icu.feigroup.domain.activity.service.discount.AbstractDiscountCalculateService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;

/**
 * projectName:icu.feigroup.domain.activity.service.discount.impl
 *
 * @author 飞
 * @since 2025/2/20 10:39
 * description:
 */
@Slf4j
@Service("ZK")
public class ZKDiscountCalculate extends AbstractDiscountCalculateService {
    @Override
    protected BigDecimal doCalculate(BigDecimal originPrice, GroupActivityDiscountVO.GroupDiscount groupDiscount) {
        String marketExpr = groupDiscount.getMarketExpr();
        BigDecimal x = new BigDecimal(marketExpr);
        BigDecimal deduction = originPrice.multiply(x);
        return compareZero(deduction);
//        return deduction.compareTo(BigDecimal.ZERO)<=0 ? new BigDecimal("0.01") : deduction;
    }
}
